# -*- encoding:utf-8 -*-
"""
@作者：jiajun_Tang
@文件名：QMyLineEdit.py
@时间：2023/4/21  上午 11:35
@文档说明:
"""


from PyQt5.QtWidgets import QWidget, QComboBox, QLineEdit, QApplication
from PyQt5.QtGui import QMouseEvent
from PyQt5.Qt import Qt, QRect, QCompleter, QSortFilterProxyModel
import sys


# 带搜索功能的下拉框
class QMyLineEdit(QLineEdit):
    def __init__(self, parent=None):
        super(QMyLineEdit, self).__init__(parent)

    # 当在Qcompleter列表选中候，下拉框项目列表选择相应的子项目
    def focusOutEvent(self, event):
        pass
        QLineEdit.focusOutEvent(self, event)

    def on_completer_activated(self, text):
        if text:
            index = self.findText(text)
            self.setCurrentIndex(index)
            # self.activated[str].emit(self.itemText(index))